<template>
	<div class="">
		<!--滚动内容 start-->
		<el-scrollbar class="app-container-scroll-bar">
		
			<listTpml :data="pageData"  ref="listTpml" @onCommand="listCommand"></listTpml>
			<log-dialog  ref="logdialog"></log-dialog>
    </el-scrollbar>
    <!--滚动内容 end -->
		
		
		<!--弹窗内容 start-->
		<div class="app-output-window">
			
			
		</div>
		<!--弹窗内容 end-->
		
	</div>
</template>

<script>
import { caozuoFilter } from '@/filters/status/index';
import listTpml from "@/view/components/listTmpl";
import logDialog from '@/view/components/log/caozuoLog';
import { deleteLog } from "@/service/swagger/LogController.js";
import { tmpStatusFilter } from '@/filters/status/index';

export default {
  components: {
    listTpml,
    logDialog
  },
  data() {
    return {
      pageData: {
        pageTitle: "操作审查",
        filterOption: [
          {
            label: "操作名称", // label名
            paramsName: "keyWord", // 出参name值
            defaultValue: "", // 出参默认值
            componentsName: "nameInput" // 组件名
          },
          {
            label: "状态查询", // label名
            paramsName: "result", // 出参name值
            defaultValue: "", // 出参默认值
            componentsName: "caozuoStatusSelect" // 组件名
          },
          {
            label: "开始时间", // label名
            paramsName: "createTimeStart", // 出参name值
            defaultValue: "", // 出参默认值
            componentsName: "startDate" // 组件名
          },
          {
            label: "结束时间", // label名
            paramsName: "createTimeEnd", // 出参name值
            defaultValue: "", // 出参默认值
            componentsName: "endDate" // 组件名
          }
        ],
        // 列表table 设置
        listOption: {
          // 列表上部btn组
          listBtns: [],
          // 列表api
          listApi: {
            url: "/appcloud-log-es/appcloudes/searchLogInfo",
            type: "POST",
          },
          // 表头设置
          header: [
            {
              label: "操作名称",
              width: "",
              propName: "operateName",
              align: "left"
            },
            {
              label: "结果",
              width: "",
              propName: "result",
              html: (row) => {
                return caozuoFilter(row.result)
              }
            },
            {
              label: "操作者",
              width: "",
              propName: "creator"
            },
            {
              label: "操作时间",
              width: "",
              propName: "createTimeFormart"
            },
            {
              label: "操作",
              width: "",
              btns: [{
                label: "详情",
                commandName: "lookDetail",
              },{
                label: "删除",
                commandName: "deleteLog",
              }],
              btnGroups: [

              ]
            }
          ]
        }
      }
    };
  },
  methods: {
    listCommand(command, row, index) {
      if (command && this[command]) {
        this[command](row, index);
      }
    },
    refresh(){
			this.$refs.listTpml.search();
		},
    lookDetail(row) {
      // this.logList = row.detail
      this.$refs.logdialog.open(row.detail)
    },
    deleteLog(row){
      this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteLog(row.id).then(ret=>{
            if(ret&&ret.code == 0){
              this.refresh()
              this.$message({type: 'success',message: '删除成功!'})
            }else{
              this.$message({type: 'error',message: '删除成功!'})
            }
          })
        })
    }
  }
};
</script>

<style>
</style>